<!-- 布局面板 -->
<template>
    <div class="layout-row" :class="{
        'is-wrap': wrap,
        'is-tip': !!tip
    }">
        <div v-if="label" class="layout-row-title">
            <el-tag>{{ label }}</el-tag>

            <template v-if="!!tip">
                <el-tooltip effect="dark" placement="top" :hide-after="0">
                    <el-icon class="question-icon"><icon-question /></el-icon>
                    <template #content>
                        <div style="width: auto;max-width: 220px;">
                            {{ tip }}
                        </div>
                    </template>
                </el-tooltip>
            </template>
        </div>
        <div class="layout-row-content">
            <slot></slot>
        </div>
    </div>
</template>

<script>
import { defineComponent, toRefs } from 'vue'
export default defineComponent({
    name: 'LayoutPane',
    props: {
        // 标题
        label: {
            type: String,
            default: ''
        },
        // 换行
        wrap: {
            type: Boolean,
            default: false
        },
        // 提示
        tip: {
            type: String,
            default: ''
        }
    },
    setup(props) {
        const { label, wrap, tip } = toRefs(props)

        return {
            label,
            wrap,
            tip
        }
    }
})
</script>

<style lang="less" scoped>
@import './layout-pane.less';
</style>